package org.example.stockdemo.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.example.stockdemo.config.R;
import org.example.stockdemo.dto.StockMonitorDTO;
import org.example.stockdemo.service.StockMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/stockMonitor")
public class StockMonitorController {

    @Autowired
    private StockMonitorService stockMonitorService;

    /**
     * 添加监控
     */
    @PostMapping("/add")
    public R<Boolean> addMonitor(@RequestBody StockMonitorDTO monitorDTO) {
        stockMonitorService.addMonitor(monitorDTO);
        return R.ok(true);
    }

    @GetMapping("/detail/{code}")
    public R<Boolean> detail(@PathVariable String code) {
        return R.ok(stockMonitorService.detail(code));
    }

}